package com.wenhai.concurrency.thread.pool;

import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

/**
 * @ClassName MyCallable
 * @Description
 * @Author 谢文海
 * @Date 2021/4/26 1:27
 * @Version 1.0
 **/
public class MyCallable implements Callable<String> {

    private final String name;
    private final long sleepTime;

    public MyCallable(String name, long sleepTime) {
        this.name = name;
        this.sleepTime = sleepTime;
    }

    @Override
    public String call() throws Exception {
        System.out.println(name);
        TimeUnit.SECONDS.sleep(sleepTime);
        return name;
    }

}
